package cxt.cn.service.impl;

import cxt.cn.service.RabbitMqService;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;

import javax.annotation.Resource;
import java.util.UUID;

/**
 * @Auther: ChengXiaotian
 * @Date: 2020-06-19 20:47
 * @Description:
 */

@EnableBinding(Source.class)
public class RabbitMqServiceImpl implements RabbitMqService {

    @Resource
    private MessageChannel output;


    @Override
    public String send() {

        UUID uuid = UUID.randomUUID();
        output.send(MessageBuilder.withPayload(uuid).build());
        System.out.println(uuid);
        return null;
    }

}
